<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>用户登录日志 - 听到微笑的博客</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/style.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/font-awesome.min.css">
<link rel="apple-touch-icon-precomposed" href="${pageContext.request.contextPath }/images/icon/icon.png">
<link rel="shortcut icon" href="${pageContext.request.contextPath }/images/icon/favicon.ico">
<script src="${pageContext.request.contextPath }/js/jquery-2.1.4.min.js"></script>
</head>

<body class="user-select">
	<section class="container-fluid">
		<jsp:include page="common/top.jsp"></jsp:include>
		<div class="row">
			<jsp:include page="common/left.jsp"></jsp:include>
			<div class="col-sm-9 col-sm-offset-3 col-md-10 col-lg-10 col-md-offset-2 main" id="main">
				<!-- <h1 class="page-header">操作</h1>
        <ol class="breadcrumb">
          <li><a href="/Loginlog/delete/action/all">清除所有登录记录</a></li>
          <li><a href="/Loginlog/delete/action/current">清除本人登录记录</a></li>
        </ol> -->
				<h1 class="page-header">
					用户登录日志
				</h1>
				<div class="table-responsive">
					<table class="table table-striped table-hover">
						<thead>
							<tr>
								<th>
									<span class="glyphicon glyphicon-th-large"></span>
									<span class="visible-lg">ID</span>
								</th>
								<th>
									<span class="glyphicon glyphicon-user"></span>
									<span class="visible-lg">用户</span>
								</th>
								<th>
									<span class="glyphicon glyphicon-time"></span>
									<span class="visible-lg">时间</span>
								</th>
								<th>
									<span class="glyphicon glyphicon-adjust"></span>
									<span class="visible-lg">IP</span>
								</th>
								<th>
									<span class="glyphicon glyphicon-remove"></span>
									<span class="visible-lg">删除</span>
								</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${pageView.items }" var="log" varStatus="s">
								<tr>
									<td>${s.count }</td>
									<td class="article-title">${log.user.username }</td>
									<td>${log.stringVisittime }</td>
									<td>${log.ipaddress }</td>
									<td>
										<a rel="1">删除</a>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
				<footer class="message_footer">
					<nav>
						<ul class="pagination pagenav">
							<li class="disabled">
								<a aria-label="Previous">
									<span aria-hidden="true">&laquo;</span>
								</a>
							</li>
							<li class="active">
								<a>1</a>
							</li>
							<li class="disabled">
								<a aria-label="Next">
									<span aria-hidden="true">&raquo;</span>
								</a>
							</li>
						</ul>
					</nav>
				</footer>
			</div>
		</div>
	</section>

	<script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
	<script src="${pageContext.request.contextPath }/js/admin-scripts.js"></script>
	<script>
//是否确认删除
$(function(){   
$("#user").addClass('active');
	$("#main table tbody tr td a").click(function(){
		var name = $(this);
		var id = name.attr("rel"); //对应id  
		if (event.srcElement.outerText === "删除") 
		{
			if(window.confirm("此操作不可逆，是否确认？"))
			{
				$.ajax({
					type: "POST",
					url: "",
					data: "id=" + id,
					cache: false, //不缓存此页面   
					success: function (data) {
						window.location.reload();
					}
				});
			};
		};
	});   
});
</script>
</body>
</html>